{include file="Public:header2"/}

<body>
<div class="layui-fluid">
    <div class="layui-card">
        <form method="get" class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <div class="layui-input-inline" style="width: 150px;margin-left: 0px">
                        <input type="text" name="user_id" value="{$Request.get.user_id}" placeholder="请输入UID" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline" style="width: 150px;margin-left: 0px">
                        <input type="text" name="mobile" value="{$Request.get.mobile}" placeholder="请输入手机号" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline" style="width: 300px;margin-left: 0px">
                        <input type="text" name="send_num" value="{$Request.get.send_num}" placeholder="请输入订单号" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block" style="margin-left: 0px">
                        <select name="status" style="width:100%;">
                            <option value="">--请选择状态--</option>
                            <option value="1" {if condition="$Request.get.status eq 1"}selected{/if}>待发货</option>
                            <option value="2" {if condition="$Request.get.status eq 2"}selected{/if}>待收货</option>
                            <option value="3" {if condition="$Request.get.status eq 3"}selected{/if}>已收货</option>
                            <option value="4" {if condition="$Request.get.status eq 4"}selected{/if}>已取消</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline" >
                    <div class="layui-input-inline" style="width: 300px;margin-left: 0px">
                        <input type="text" id="addtime" name="addtime" value="{$Request.get.addtime}" class="layui-input" placeholder="申请时间" autocomplete="off" >
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </form>

        <div class="layui-card-body">
            <xblock>
                <div style="padding-bottom: 10px;">
                    <a class="layui-btn" href="{:url('/admin/send_order_daochu',['user_id'=>$user_id,'mobile'=>$mobile,'send_num'=>$send_num,'addtime'=>$str_addtime,'status'=>$status])}">导出订单</a>
                    <span style="line-height:40px;float:right;">共有数据： {$count}条</span>
                </div>
            </xblock>
            <table class="layui-table" style="text-align:center">
                <thead>
                <tr>
                    <th>用户信息</th>
                    <th>订单号</th>
                    <th>发货数量</th>
                    <th>运费</th>
                    <th>收货信息</th>
                    <th>订单状态</th>
                    <th>申请时间</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td style="text-align: left">
                        <div style="display: flex;">
                            <div><img src="{:imageUrl($vo['headimg'])}" alt="" width="50px" height="50px"></div>
                            <div style="margin-left: 10px">
                                <p style="color: #ff5722c2;font-size: 9px">UID：{$vo['user_id']}</p>
                                <p style="color: #666666ba;font-size: 9px">{$vo['mobile']}</p>
                                <p style="color: #666666ba;font-size: 9px">{$vo['nickname']}</p>
                            </div>
                        </div>
                    </td>
                    <td>{$vo.send_num}</td>
                    <td>{$vo.count}</td>
                    <td>{$vo.freight}</td>
                    <td style="text-align: left;">
                        <p style="font-weight: bold">{$vo['name']} {$vo['mobile']}</p>
                        <p>{$vo['address']}</p>
                    </td>
                    <td>
                        {if $vo['status'] eq 1 /}
                        <button class="layui-btn layui-btn-warm layui-btn-radius layui-btn-sm">待发货</button>
                        {elseif $vo['status'] eq 2 /}
                        <button class="layui-btn layui-btn-warm layui-btn-radius layui-btn-sm">待收货</button>
                        {elseif $vo['status'] eq 3 /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">已收货</button>
                        {elseif $vo['status'] eq 4 /}
                        <button class="layui-btn layui-btn-danger layui-btn-radius layui-btn-sm">后台取消</button>
                        {/if}
                    </td>
                    <td style="width: 130px">
                        <p>{$vo['addtime']|date="Y-m-d H:i:s"}</p>
                    </td>
                    <td>{$vo.message}</td>
                    <td style="width: 200px">
                        {if $vo.status lt 4}
                        <a onClick="detail({$vo.id})"  class="layui-btn layui-btn-normal layui-btn-xs">查看详情</a>
                        <a onClick="cancel_order({$vo.id})"  class="layui-btn layui-btn-danger layui-btn-xs">取消发货</a>
                        {/if}
                    </td>
                </tr>
                {/volist}

                {if condition="empty($list)"}
                <tr><td colspan='10' style="text-align:center;">暂时没有数据！</td></tr>
                {/if}
                </tbody>
            </table>
            <div class="my_page layui-box layui-laypage layui-laypage-default">
                {$page|raw}
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
<script type="text/javascript">
    layui.use(['table','laydate'], function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#addtime'
            ,type: 'datetime'
            ,range: true
        });
    });

    //详情
    function detail(id) {
        var url  = "{:url('/admin/send_order_detail?id="+id+"')}";
        layer.open({
            type: 2,
            title: '订单详情',
            shadeClose: false,
            shade: 0.3,
            area: ['90%', '90%'],
            content: url,
        });
    }

    //订单取消
    function cancel_order(id) {
        layer.confirm('确认要执行删除操作吗？',function(){
            var url = "{:url('/admin/cancel_order')}";
            var load=layer.load(2);
            var $ = layui.$;
            $.post(url,{"id":id},function(data){
                if(data.status == 1){
                    layer.msg('取消成功',{icon:1,time:1000},function(){
                        location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon:2,anim:6,time:1000},function(){
                        layer.close(load);
                    });
                }
            })
        });
    }

</script>
</body>
</html>


